package com.weixin.paleituo.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.weixin.paleituo.bean.CarouselBean;
import com.weixin.paleituo.fragment.StoreAllGoodsFragment;
import com.weixin.paleituo.fragment.StoreHomeFragment;

import java.util.List;

/**
 * Author yichao
 * Time  2017/11/30 9:34
 * Dest  店铺首页
 */

public class StoreHomePagerAdapter extends FragmentPagerAdapter {
    private int mStoreId;
    private List<CarouselBean> mCarousel;

    public StoreHomePagerAdapter(FragmentManager fm, int storeId, List<CarouselBean> carousel) {
        super(fm);
        mStoreId = storeId;
        mCarousel = carousel;
    }
    @Override
    public Fragment getItem(int position) {
        if (position == 0) {


            return  StoreHomeFragment.getInstance(mStoreId,mCarousel);
        } else {
            return  StoreAllGoodsFragment.getInstance(mStoreId);
        }

    }

    @Override
    public int getCount() {
        return 2;
    }
}
